#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>

void func(void)
{

	int i = 1;
	// (++i) + (++i);
	// printf("i: %d   %d\n", i, (++i) + (++i));

	int Sensor_Total_Width = 0, Sensor_Shoulder_Width = 0;
	char buf[100] = "090000;001000";

	sscanf(buf, "%04d;%04d", &Sensor_Total_Width, &Sensor_Shoulder_Width);
	printf("Sensor_Total_Width: %4d   Sensor_Shoulder_Width: %4d\n",
		   Sensor_Total_Width,
		   Sensor_Shoulder_Width);

	Sensor_Total_Width = 999999;
	Sensor_Total_Width = Sensor_Total_Width % 10000;
	sprintf(buf, "%04d;%04d;%03d;", Sensor_Total_Width, Sensor_Shoulder_Width, 1233 % 100);
	printf("buf: %s\n", buf);

	// 算术优先级测试
	printf("calc test\n");
	int32_t Step = 0, Number[] = {10, 20, 30, 40, 50, 60, 70, 80, 90};

	Step = Number[0] -
		   (Number[1] / 2) +
		   Number[2] -
		   Number[3] -
		   (Number[4] / 2);

	printf("Step: %d\n", Step);

	uint16_t num[20] = {0};
	num[1] = 0xffff;
	num[2] = 0x66;
	num[3] = num[1] & 0x0000ffff;
	num[4] = num[1] >> 16;
	sprintf(buf, "%#x %#x %#x %#x \n", num[1], num[2], num[3], num[4]);
	printf("buf: %s\n", buf);
}

int main(void)
{
	func();
	return 0;
}